package gallery.controller.action;

import gallery.model.GalleryBean;
import gallery.model.service.GalleryService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionFormBean;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.config.FormBeanConfig;

public class DetailAction extends Action{
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{
		String idx=request.getParameter("idx");
		GalleryService service=new GalleryService();
		GalleryBean bean = service.getBeanByIdx(Integer.parseInt(idx));
		
		request.setAttribute("bean", bean);
		
		return mapping.findForward("/result/gallery/detail");
		
	}
}
